package com.tjetc.common;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class Resp {
    private Integer code;//响应码
    private Map<String ,Object> data = new HashMap<>();

    public static Resp ok(){
        Resp resp = new Resp();
        resp.setCode(0);
        return resp;
    }

    public static Resp error(){
        Resp resp = new Resp();
        resp.setCode(-1);
        return resp;
    }

    public Resp data(String key, Object value){
        this.data.put(key,value);
        return this;
    }
}